#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class ObserverBase;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
public slots:
    void newWidget();

protected:
    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent * event) override;


    /* 观察者 */
    void attach(ObserverBase * obj);
    void detach(ObserverBase * obj);
    void notify();

private:
    Ui::MainWindow *ui;

    QPoint mousePressPoint;
    QPoint mouseReleasePoint;

    QList<ObserverBase*> listView;//保存多个对象等待通知

};

#endif // MAINWINDOW_H
